package com.test.reactor.actor;

import akka.actor.AbstractActor;
import akka.actor.ActorSelection;

public class LookupActor  extends AbstractActor{ 
       
    private ActorSelection remote = null; 
   
    public LookupActor(String path) { 
    	System.out.println("path--"+ path);
        remote = this.context().actorSelection(path);
    } 

	@Override
	public Receive createReceive() {
		Receive build = receiveBuilder().matchAny(o -> {
            System.out.println("LookupActor 接受到消息：" + o);
            if (o.toString().startsWith("a"))
            	remote.tell(o, this.getSelf());
        }).build();
        return build;
	} 
}